import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/views/Login.vue'
import NotFound from '@/views/NotFound.vue'

const routes = [
  {
    path: '/',
    name: 'Login',
    component: Login
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('@/views/Home.vue'),
    meta: {
      menu: {
        title: '主页',
        icon: 'i-shouyeguanli',
        index: '/home'
      }
    }
  },
  {
    path: '/console',
    name: 'Console',
    component: () => import('@/views/Console.vue'),
    meta: {
      menu: {
        title: '控制台',
        icon: 'i-kongzhitaiguanli',
        index: '/console'
      }
    },
    children: [

      {
        path: 'publish-management',
        name: 'PublishManagement',
        component: () => import('@/views/Console/PublishManagement.vue'),
        meta: {
          menu: {
            title: '发布管理',
            icon: 'i-fabuguanli'
          }
        }
      },
      {
        path: 'short-video-management',
        name: 'ShortVideoManagement',
        component: () => import('@/views/Console/ShortVideoManagement.vue'),
        meta: {
          menu: {
            title: '短视频管理',
            icon: 'i-shipinguanli'
          }
        }
      },
      {
        path: 'private-message-management',
        name: 'PrivateMessageManagement',
        component: () => import('@/views/Console/PrivateMessageManagement.vue'),
        meta: {
          menu: {
            title: '私聊管理',
            icon: 'i-xiaoxi'
          }
        }
      },
      {
        path: 'industry-map',
        name: 'IndustryMap',
        component: () => import('@/views/Console/IndustryMap.vue'),
        meta: {
          menu: {
            title: '产业图谱',
            icon: 'i-bofangtongji'
          }
        }
      },
    ]
  },
  {
    path: '/user-management',
    name: 'UserManagement',
    component: () => import('@/views/UserManagement.vue'),
    meta: {
      menu: {
        title: '用户管理',
        icon: 'i-yonghuguanli',
        index: '/user-management'
      }
    }
  },
  {
    path: '/file-management',
    name: 'FileManagement',
    component: () => import('@/views/FileManagement.vue'),
    meta: {
      menu: {
        title: '文件管理',
        icon: 'i-wenjianguanli',
        index: '/file-management'
      }
    }
  },
  {
    path: '/notification-management',
    name: 'NotificationManagement',
    component: () => import('@/views/NotificationManagement.vue'),
    meta: {
      menu: {
        title: '通知管理',
        icon: 'i-tongzhiguanli',
        index: '/notification-management'
      }
    }
  },
  {
    path: '/permission-management',
    name: 'PermissionManagement',
    component: () => import('@/views/PermissionManagement.vue'),
    meta: {
      menu: {
        title: '权限管理',
        icon: 'i-quanxianguanli',
        index: '/permission-management'
      }
    }
  },
  {
    path: '/log-management',
    name: 'LogManagement',
    component: () => import('@/views/LogManagement.vue'),
    meta: {
      menu: {
        title: '日志管理',
        icon: 'i-rizhiguanli',
        index: '/log-management'
      }
    }
  },
  {
    path: '/short-video-management/detail/:id',
    name: 'ShortVideoDetail',
    component: () => import('@/views/Console/ShortVideoManagement/VideoDetailPage.vue')
  },
  {
    path: '/publish-management/detail/:id',
    name: 'PublishDetail',
    component: () => import('@/views/Console/PublishManagement/PublishDetailPage.vue')
  },
  // 404页面，必须放在最后
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: NotFound
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router